package com.wmm.fast.order.controller.client;

import com.wmm.common.bean.ResponseResultDTO;
import com.wmm.common.bean.user.User;
import com.wmm.fast.order.model.request.BalanceReservationRequest;
import com.wmm.fast.order.model.response.ReservationResponse;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @Auther: wangzun
 * @Date: 2018/9/14 18:41
 * @Description:
 */
@FeignClient(name = UserClient.SERVICE_ID,fallback = UserClientFallBack.class)
public interface UserClient {
    String SERVICE_ID = "user-service";

    String API_PATH = "/api/v1";

    @RequestMapping(value = API_PATH + "/users/findUser/{id}",method = RequestMethod.GET)
    ResponseResultDTO<User> findUser(@PathVariable("id") Long userId);

    @RequestMapping(value = API_PATH + "/users/reservation",method = RequestMethod.POST)
    ReservationResponse reserve( @RequestBody BalanceReservationRequest request);
}
